package de.wesemann.jdedun.implementation.calendar;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.wesemann.jdedun.entities.calendar.events.CalendarEvent;
import de.wesemann.jdedun.entities.calendar.events.CalendarEventsContainer;
import de.wesemann.jdedun.implementation.AbstractResource;
import de.wesemann.jdedun.implementation.ImplementationInterface;

public class CalendarEventsImpl implements ImplementationInterface {
    private String urlStub = "calendar/events";
    private Logger logger = LoggerFactory.getLogger(CalendarHostsImpl.class);

    private AbstractResource resource = new AbstractResource(urlStub);

    public int count() {
	return resource.count();
    }

    /**
     * 
     * @return
     */
    public List<CalendarEvent> getAll() {
	return resource.getAll(CalendarEventsContainer.class).getData();
    }

    /**
     * 
     * @param n
     * @return
     */
    public List<CalendarEvent> getFirstN(int n) {
	return resource.get(n, 0, CalendarEventsContainer.class).getData();
    }

    public List<CalendarEvent> getNextN(int n, int offest) {
	return resource.get(n, offest, CalendarEventsContainer.class).getData();
    }

    /**
     * 
     * @param searchTupel
     * @return
     */
    public List<CalendarEvent> search(Map<String, String> searchTupel) {
	return resource.search(searchTupel, CalendarEventsContainer.class)
		.getData();
    }

    public String getURLStub() {
	return urlStub;
    }

    public void setURLStub(String urlStub) {
	this.urlStub = urlStub;

    }
}
